package com.glory.eapequipmentmonitor.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.widget.TextView;

import com.glory.eapequipmentmonitor.R;
import com.glory.eapequipmentmonitor.bean.UserInfoBean;
import com.pda.platform.ui.ui_pdaplatform.base.FreeUI_BaseFragment;
import com.pda.platform.ui.ui_pdaplatform.entity.FreeUI_AddViewEntity;

import butterknife.BindView;
import butterknife.OnClick;
import butterknife.Unbinder;

public class MineFragment extends FreeUI_BaseFragment {

    @BindView(R.id.toolbar)
    Toolbar toolbar;
    Unbinder unbinder;
    @BindView(R.id.collapsing_toolbar_layout)
    CollapsingToolbarLayout collapsingToolbarLayout;
    @BindView(R.id.gender_Txt)
    TextView genderTxt;
    @BindView(R.id.department_Txt)
    TextView departmentTxt;
    @BindView(R.id.status_Txt)
    TextView statusTxt;
    @BindView(R.id.degree_Txt)
    TextView degreeTxt;
    @BindView(R.id.birthday_Txt)
    TextView birthdayTxt;
    @BindView(R.id.createdate_Txt)
    TextView createdateTxt;

    private UserInfoBean userInfoBean;

    public MineFragment() {
        // Required empty public constructor
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.fragment_mine;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initView() {
        collapsingToolbarLayout.setCollapsedTitleGravity(Gravity.CENTER);//设置收缩后标题的位置
        //collapsingToolbarLayout.setExpandedTitleGravity(Gravity.CENTER);////设置展开后标题的位置
//        collapsingToolbarLayout.setExpandedTitleColor(Color.WHITE);//设置展开后标题的颜色
//        collapsingToolbarLayout.setCollapsedTitleTextColor(Color.WHITE);//设置收缩后标题的颜色
    }

    private void fillData() {
        toolbar.setTitle(userInfoBean.getCname());//设置标题的名字
        genderTxt.setText(userInfoBean.getGender());
        departmentTxt.setText(userInfoBean.getDepartment());
        statusTxt.setText(userInfoBean.getStatus());
        degreeTxt.setText(userInfoBean.getDegree());
        birthdayTxt.setText(userInfoBean.getBirthday());
        createdateTxt.setText(userInfoBean.getCreatedate());
    }

    @Override
    protected void initData() {
        userInfoBean = new UserInfoBean();
        userInfoBean.setCname("张三");
        userInfoBean.setDepartment("IT部门");
        userInfoBean.setGender("男");
        userInfoBean.setStatus("在职");
        userInfoBean.setDegree("本科");
        userInfoBean.setBirthday("1990-11-11");
        userInfoBean.setCreatedate("2011-12-31");
        fillData();
    }

    @Override
    protected FreeUI_AddViewEntity getBaseEntity() {
        return null;
    }


    @OnClick(R.id.logout_Bv)
    public void onViewClicked() {
//        App.empid = "";
//        FreeApi_SharePreferencesUtils.setSharePre(Constant.ShAREPREFERENCES_NAME, "empid", "", getActivity());
//        FreeApi_ActivityManager.getActivityManager().finishAllActivity();
//        FreeApi_Utils.skipWithExtraIntent("", getActivity(), LoginActivity.class);
    }
}
